BIN=process
SRC=$(wildcard *.c)
OBJ=$(SRC:.c=.o)
CC=gcc
RM=rm -f

$(BIN): $(OBJ)
	$(CC) $^ -o $@

%.o: %.c
	$(CC) -c $<  -g

.PHONY: clean test

clean:
	$(RM) $(OBJ) $(BIN)
	@echo "清理完成"

test:
	@echo "可执行文件: $(BIN)"
	@echo "源文件: $(SRC)"
	@echo "目标文件: $(OBJ)"

#BIN=mytest
##SRC=$(shell ls *.c)
#SRC=$(wildcard *.c)
#OBJ=$(SRC: .c=.o)
#CC=gcc
#RM=rm -f
#
#$(BIN):$(OBJ)
#	$(CC) $^ -o $@
#%.o : %.c
#	$(CC) -c $< 
#	@echo "链接 $^ 成 $@"
#
#.PHONY:clean
#	clean:
#	$(RM) $(OBJ) $(BIN)
#	@echo "编译...  $< 成 $@“
#
#.PHONY:test
#test:
#	@echo $(BIN)
#	@echo $(SRC)
#	@echo $(OBJ)



#$(BIN):$(OBJ)
#	gcc $(OBJ) -o $(BIN)
#$(OBJ):$(SRC)
#	gcc -c $(SRC) -o $(OBJ)
#
#.PHONY:clean
#clean:
#	$(RM) $(BIN) $(OBJ)

#mytest:mytest.o
#	gcc mytest.o -o mytest
#mytest.o:test.c
#	gcc -c test.c -o mytest.o
#
#.PHONY:clean
#clean:
#	rm -f *.o mytest





#mytest:test.o
#	gcc test.o -o mytest
#test.o:test.s
#	gcc -c test.s -o test.o
#test.s:test.i
#	gcc -S test.i -o test.s
#test.i:test.c
#	gcc -E test.c -o test.i
#
#.PHONY:clean
#clean:
#	rm -f *.i *.s *.o mytest




#mytest:test.c
#	gcc test.c -o mytest
#
#.PHONY:clean
#clean:
#	rm -f mytest
